package com.itheima.controller;

import com.itheima.pojo.User;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/findById")
    public String findById(int id){

        System.out.println("需要查询的id是:"+id);

        return "查询到了！";
    }

    @GetMapping("/{id}/{num}")
    public String testGet(@PathVariable int num){

        System.out.println("传递的参数id:"+num);
        return "get success";
    }


    @PostMapping("")
    public String testPost(@RequestBody User user){

        System.out.println("传递的对象:"+user);
        return "post success";
    }


    @PutMapping("")
    public String testPut(@RequestBody User user){

        System.out.println("传递的对象:"+user);
        return "put success";
    }


    @DeleteMapping("/{id}")
    public String testDelete(@PathVariable int id){

        System.out.println("传递的参数id:"+id);
        return "delete success";
    }
}
